package com.itheima.controller;


import com.itheima.service.ReportService;
import com.itheima.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 查询不同岗位员工数量
     *
     * @return
     */
    @GetMapping(path = "/empJobData")
    public Result<Map<String, List<Object>>> queryJobCount() {
        return Result.success(reportService.queryJobCount());
    }


    @GetMapping("/empGenderData")
    public Result<List<Map<String, Object>>> queryGenderCount() {
        List<Map<String, Object>> genderCountList = reportService.queryGenderCount();
        return Result.success(genderCountList);
    }

    @GetMapping("/studentCountData")
    public Result<Map<String, List<Object>>> queryClazzCount() {
        return Result.success(reportService.queryClazzCount());
    }

    @GetMapping("/studentDegreeData")
    public Result<List<Map<String, Object>>> queryDegreeData() {
        List<Map<String, Object>> degreeCount = reportService.queryDegreeData();
        return Result.success(degreeCount);
    }

}
